package cn.hls.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * @fileName: User.java
 * @descrption: 实体基类，其他类继承该类
 * @author : yinghui.zhang
 * @Email: uuhui@163.com
 * @date 2015-4-3
 * @version 1.0
 */
@MappedSuperclass
public class BaseEntity implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	// 编号
	private Long id;
	// 是否删除
	private Boolean deleted = false;
	// 创建时间
	private Date createTime = new Date();
	// 修改时间
	private Date updateTime = new Date();

	@Id
	//@GeneratedValue(strategy = GenerationType.AUTO)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "is_deleted", nullable = false,length=1, columnDefinition="char default 0")
	public Boolean getDeleted() {
		return deleted;
	}

	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}

	@Column(name = "create_time",  nullable = false)
	@Temporal(TemporalType.DATE)
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Column(name = "update_time")
	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public BaseEntity() {

	}

	public BaseEntity(Long id) {
		this.id = id;
	}
}
